//
//  KKAnalytics.h
//  KKAnalytics
//
//  Created by Win Jay on 2019/8/23.
//  Copyright © 2019年 Win Jay. All rights reserved.
//
#define RECEIPT_VALIDATION_URL @"https://subscribe.buttondc.info/subscribe/post"
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <AdSupport/AdSupport.h>



NS_ASSUME_NONNULL_BEGIN

@interface KKAnalytics : NSObject

@property BOOL isInitAdjust;
@property BOOL isInitFacebook;
@property BOOL isInitThinkingData;
@property BOOL isInitFirebase;

+(instancetype)shareManager;

-(NSString *)getAdvertisementID;


/// 初始化Adjust
/// @param app_id  Adjust app token
-(void)initAdjust:(NSString *)app_id;


/// 初始化Adjust
/// @param app_id Adjust app token
/// @param secretId 密钥id
/// @param info1 参数一
/// @param info2 参数二
/// @param info3 参数三
/// @param info4 参数四
-(void)initAdjust:(NSString *)app_id  secretID: (NSUInteger)secretId
            info1:(NSUInteger)info1
            info2:(NSUInteger)info2
            info3:(NSUInteger)info3
            info4:(NSUInteger)info4;


/// 初始化facebook
/// @param fb_id  facebook 应用id
-(void)initFacebook:(NSString *)fb_id;

/// 初始化firebase
-(void)initFirebase;

/// 初始化ThinkingData
/// @param app_id 数数应用id
-(void)initThinkingData:(NSString *)app_id;

/// 开启数数调试日志
-(void)setThinkingDataDebubgModel;
//-(void)setThinkingDataAutoTrack;


/// Adjust基本打点事件
/// @param eventToken Adjust事件token
-(void)logAdjustEvent:(NSString *)eventToken;

/// Adjust 收入事件汇报
/// @param eventToken  Adjust 收入token
/// @param prices 价格
/// @param code 货币符号
-(void)logAdjustRevenue:(NSString *)eventToken price:(double)prices currencyCode:(NSString*)code;

/// Adjust广告收入汇报
/// @param data Mopub广告的时时展示会传数据
-(void)logAdjsutAdRevenue:(NSData *)data;


/// facebook基本打点事件
/// @param eventName 事件名称
/// @param dic 参数
-(void)logFacebookEvent:(NSString *)eventName params:(NSDictionary *__nullable)dic;


/// 基本firebase打点事件
/// @param eventName 事件名称
/// @param dic 参数
-(void)logFirebaseEvent:(NSString *)eventName params:(NSDictionary *__nullable)dic;


/// 设置firebase用户属性
/// @param property 属性值
/// @param forName 属性名称
-(void)setFirebaseUserProperty:(NSString *)property propertyName:(NSString*)forName;


/// firebase和facebooky通用打点事件
/// @param eventName 事件名称
/// @param dic 参数
-(void)logFacebookFirebaseTKEvent:(NSString *)eventName params:(NSDictionary *__nullable)dic;


/// 数数基本打点事件
/// @param trackName 事件名称
/// @param dic 参数
-(void)logTKEvent:(NSString *)trackName params:(NSDictionary *__nullable)dic;

/// 数数设置访客id
/// @param visitorID 访客id
-(void)setTKVisitorID:(NSString *)visitorID;

/// 数数设置用户id
/// @param loginID 用户id（一般为广告id）
-(void)setTKLoginID:(NSString *)loginID;

/// 退出当前用户
-(void)setTKLogout;


/// 设置公共事件
/// @param properties 事件名称
-(void)setTKSuperProperties:(NSDictionary * )properties;

/// 删除公共事件
/// @param propertyName 已存在的公共事件名称
-(void)unSetTKSuperProperties:(NSString *)propertyName;

/// 设置数数事件时长
/// @param timeName 事件市场名称
-(void)setTKTimeTrackEvent:(NSString *)timeName;

/// 设置数数用户属性
/// @param userInfo     参数
-(void)setTKUser:(NSDictionary*)userInfo;

/// 设置数数用户属性（只在第一次设置时生效）
/// @param userInfo 参数
-(void)setTKUserOnce:(NSDictionary*)userInfo;

///  设置用户累加事件
/// @param addInfo 增加的信息
-(void)setTKUserAdd:(NSDictionary *)addInfo;

/// 删除用户
-(void)deleteTKUser;

/// 服务器验证收入上报
/// @param transaction_id 交易id
/// @param point 购买位置
-(void)validateReceiptViaServer:(NSString *)transaction_id purchasePoint:(NSString *)point;

/// 注册deviceToken
/// @param diviceToken 设备token
-(void)registerNotificationWithDiveceToken: (NSData *)diviceToken;


-(void)registerNotificationSetting: (UIApplication *)application;
-(void)registerNotificationWhenAppLaunch:(UIApplication *)application;

-(NSDictionary *)convertStringToDictionary:(NSString *__nullable)json;
@end

NS_ASSUME_NONNULL_END
